package com.yida.gwj.expend.outside.service;

import java.util.List;

import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson2.JSONObject;
import com.yida.common.core.domain.R;
import com.yida.gwj.api.domain.GwjConfFlow;
import com.yida.gwj.common.domain.GwjBaseBuild;
import com.yida.gwj.common.domain.GwjBaseCommunity;
import com.yida.gwj.common.domain.request.GwjBaseBuildRequest;
import com.yida.gwj.common.enums.GwjBusinessFlagType;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusiness;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessBuild;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessHouse;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessLog;
import com.yida.gwj.expend.outside.domain.dto.AddUseApplyFormDTO;
import com.yida.gwj.expend.outside.domain.dto.AllocatedAmountListDTO;
import com.yida.gwj.expend.outside.domain.dto.AllocatedAmountSelectDTO;
import com.yida.gwj.expend.outside.domain.dto.ApplicationReportDTO;
import com.yida.gwj.expend.outside.domain.dto.ApplyBaseInfoDTO;
import com.yida.gwj.expend.outside.domain.dto.ChangeSchemeDTO;
import com.yida.gwj.expend.outside.domain.dto.CostListDTO;
import com.yida.gwj.expend.outside.domain.dto.DeveloperListDTO;
import com.yida.gwj.expend.outside.domain.dto.GetBusinessDetailDTO;
import com.yida.gwj.expend.outside.domain.dto.GwjBusinessBaseInfoDTO;
import com.yida.gwj.expend.outside.domain.dto.GwjHouseOwnerListDTO;
import com.yida.gwj.expend.outside.domain.dto.GwjMaintenanceFundsBusinessListDTO;
import com.yida.gwj.expend.outside.domain.dto.OwnerCheckProveDTO;
import com.yida.gwj.expend.outside.domain.dto.OwnerCommentsDTO;
import com.yida.gwj.expend.outside.domain.dto.StepConfigInfoDTO;
import com.yida.gwj.expend.outside.domain.message.PreAcceptSubmitMessage;
import com.yida.gwj.expend.outside.domain.request.AllocatedAmountRequest;
import com.yida.gwj.expend.outside.domain.request.GwjHouseOwnerListRequest;
import com.yida.gwj.expend.outside.domain.request.GwjMaintenanceFundsBusinessAddRequest;
import com.yida.gwj.expend.outside.domain.request.GwjMaintenanceFundsBusinessListRequest;
import com.yida.gwj.expend.outside.domain.request.GwjMaintenanceFundsBusinessRequest;
import com.yida.gwj.expend.outside.domain.request.GwjMaintenanceFundsCommunityListRequest;
import com.yida.gwj.expend.outside.domain.request.HousesUnderBuildRequest;
import com.yida.gwj.expend.outside.domain.request.ShareEquallyMoneyRequest;
import com.yida.gwj.expend.outside.enums.BusinessAttachmentServerTypeEnum;

/**
 * 公维金维修资金业务Service接口
 *
 * @author lgp
 * @date 2023-02-20
 */
@EnableAspectJAutoProxy(exposeProxy = true)
public interface IGwjMaintenanceFundsBusinessService {
    /**
     * 查询公维金维修资金业务
     *
     * @param bizId 公维金维修资金业务主键
     * @return 公维金维修资金业务
     */
    GwjMaintenanceFundsBusiness selectGwjMaintenanceFundsBusinessByBusinessId(Long bizId);

    /**
     * 查询公维金维修资金业务列表
     *
     * @param maintenanceFundsBusinessListRequest 公维金维修资金业务
     * @return 公维金维修资金业务集合
     */
    List<GwjMaintenanceFundsBusinessListDTO> getGwjMaintenanceFundsBusinessList(GwjMaintenanceFundsBusinessListRequest maintenanceFundsBusinessListRequest);

    /**
     * 新增公维金维修资金业务
     *
     * @param gwjMaintenanceFundsBusiness 公维金维修资金业务
     * @return 结果
     */
    GwjMaintenanceFundsBusiness insertGwjMaintenanceFundsBusiness(GwjMaintenanceFundsBusiness gwjMaintenanceFundsBusiness);

    /**
     * 修改公维金维修资金业务
     *
     * @param gwjMaintenanceFundsBusiness 公维金维修资金业务
     * @return 结果
     */
    GwjMaintenanceFundsBusiness updateGwjMaintenanceFundsBusiness(GwjMaintenanceFundsBusiness gwjMaintenanceFundsBusiness);

    /**
     * 新增公维金使用资金申请业务
     *
     * @param gwjMaintenanceFundsBusinessAddRequest gwj维修基金业务请求
     * @return int
     */
    AddUseApplyFormDTO addMaintenanceFundsBusinessForm(GwjMaintenanceFundsBusinessAddRequest gwjMaintenanceFundsBusinessAddRequest);

    /**
     * 前接受提交 提交数据到内网
     *
     * @param bizId 业务标识
     * @param attachmentServerTypeEnumList 附件服务器类型枚举列表
     * @return int
     */
    PreAcceptSubmitMessage preAcceptSubmit(Long bizId, List<BusinessAttachmentServerTypeEnum> attachmentServerTypeEnumList);

    /**
     * 分摊金额-已选择
     *
     * @param allocatedAmountRequest 分配数量要求
     * @param businessFlagType 业务标志类型
     * @return AllocatedAmountSelectDTO
     */
    AllocatedAmountSelectDTO allocatedAmountList(AllocatedAmountRequest allocatedAmountRequest, GwjBusinessFlagType businessFlagType);

    /**
     * 小区业主信息管理 查询小区列表
     *
     * @param communityListRequest 查询条件
     * @return List<GwjMaintenanceFundsBusinessCommunityDTO> 结果列表
     */
    List<GwjBaseCommunity> selectCommunityList(GwjMaintenanceFundsCommunityListRequest communityListRequest);

    /**
     * 按类型平摊金额
     *
     * @param shareEquallyMoneyRequest
     * @return AllocatedAmountSelectDTO
     */
    int shareEquallyMoney(ShareEquallyMoneyRequest shareEquallyMoneyRequest);

    /**
     * 小区业主信息管理 查询业主及其房屋信息列表
     *
     * @param houseOwnerListRequest 查询条件
     * @return List<GwjMaintenanceFundsBusinessCommunityDTO> 结果列表
     */
    List<GwjHouseOwnerListDTO> selectHouseOwnerList(GwjHouseOwnerListRequest houseOwnerListRequest);

    /**
     * 修改平摊金额
     *
     * @param shareEquallyMoneyRequest
     * @return AllocatedAmountSelectDTO
     */
    int shareEquallyMoneyUpdate(ShareEquallyMoneyRequest shareEquallyMoneyRequest);

    /**
     * 分摊金额-选中房屋
     *
     * @param allocatedAmountRequest
     * @return AllocatedAmountSelectDTO
     */
    int allocatedAmountArrange(AllocatedAmountRequest allocatedAmountRequest);

    /**
     * 使用申请-资金分摊-未选中列表
     *
     * @param allocatedAmountRequest 列表请求
     * @return 公维金维修资金业务
     */
    List<GwjMaintenanceFundsBusinessHouse> allocatedAmountCancelList(AllocatedAmountRequest allocatedAmountRequest);

    /**
     * 分摊金额-取消选中房屋
     *
     * @param allocatedAmountRequest
     * @return AllocatedAmountSelectDTO
     */
    int allocatedAmountCancel(AllocatedAmountRequest allocatedAmountRequest);

    /**
     * 编辑维护基金业务表单 更改公维金使用资金申请业务
     *
     * @param gwjMaintenanceFundsBusinessAddRequest gwj维修基金业务请求
     * @return int
     */
    int editMaintenanceFundsBusinessForm(GwjMaintenanceFundsBusinessAddRequest gwjMaintenanceFundsBusinessAddRequest);

    /**
     * 查看申请报告
     *
     * @param bizId
     * @return AllocatedAmountSelectDTO
     */
    ApplicationReportDTO getApplicationReport(Long bizId);

    /**
     * 查看业主征求意见
     *
     * @param bizId
     * @return AllocatedAmountSelectDTO
     */
    OwnerCommentsDTO getOwnerComments(Long bizId);

    /**
     * 获取改造方案
     *
     * @param bizId 业务标识
     * @return {@link ChangeSchemeDTO}
     */
    ChangeSchemeDTO getTransformationPlan(Long bizId);

    /**
     * 获取业主确认证明
     *
     * @param bizId 业务标识
     * @return {@link OwnerCheckProveDTO}
     */
    OwnerCheckProveDTO getOwnerCheckProve(Long bizId);

    /**
     * 二次补件提交数据到内网
     *
     * @param bizId 业务标识
     * @return int
     */
    int preAcceptSecondSubmit(Long bizId);

    /**
     * 资金使用申请业务回填信息查询
     *
     * @param communityId 社区id
     * @return 资金使用申请业务回填信息
     */
    ApplyBaseInfoDTO getCommunity(Long communityId);

    /**
     * 获取开发商列表
     *
     * @param companyName 公司名称
     * @return {@link List}<{@link String}>
     */
    List<DeveloperListDTO> getDevelopers(String companyName);

    /**
     * 查询楼栋列表
     *
     * @param buildName 楼栋名称
     * @param communityId 社区id
     * @return {@link List}<{@link GwjBaseBuild}>
     */
    List<GwjBaseBuild> getBuilds(Long communityId, String buildName);

    /**
     * 查询业务基础信息
     *
     * @return {@link GwjBusinessBaseInfoDTO}
     */
    GwjBusinessBaseInfoDTO getUseApplyInfo();

    /**
     * 根据flowId查询业务流程
     *
     * @param flowId 业务流程主键
     * @return 业务流程
     */
    GwjConfFlow selectGwjConfFlowByFlowId(Long flowId);

    /**
     * 得到gwj维修基金业务
     *
     * @param maintenanceFundsBusinessRequest 维修基金业务请求
     * @return {@link GwjMaintenanceFundsBusiness}
     */
    GwjMaintenanceFundsBusiness getGwjMaintenanceFundsBusiness(GwjMaintenanceFundsBusinessRequest maintenanceFundsBusinessRequest);

    /**
     * 获取gwj维修基金业务详细信息
     *
     * @param bizId 业务标识
     * @return {@link GetBusinessDetailDTO}
     */
    GetBusinessDetailDTO getDetailMessage(Long bizId);

    /**
     * 得到一步配置信息 获取步骤按钮权限信息
     *
     * @param businessFlagType 业务标志类型
     * @return 查询业务基础信息
     */
    StepConfigInfoDTO getStepConfigInfo(GwjBusinessFlagType businessFlagType);

    /**
     * 得到选择构建 获取已选中楼栋信息
     *
     * @param bizId 商业标识
     * @return 获取已选中楼栋信息
     */
    List<GwjMaintenanceFundsBusinessBuild> getSelectBuilds(Long bizId);

    /**
     * 获取楼栋下房屋信息
     *
     * @param housesUnderBuildRequest 房子在构建请求
     * @return 楼栋下房屋信息
     */
    List<GwjMaintenanceFundsBusinessHouse> getHouseList(HousesUnderBuildRequest housesUnderBuildRequest);

    /**
     * 导出房屋数据
     *
     * @param allocatedAmountRequest
     * @return 楼栋下房屋信息
     */
    List<AllocatedAmountListDTO> exportHouseList(AllocatedAmountRequest allocatedAmountRequest);

    /**
     * 获取业务详细信息 sql查询
     *
     * @param bizId 商业标识
     * @return {@link GetBusinessDetailDTO}
     */
    GetBusinessDetailDTO getBusinessDetailMessage(Long bizId);

    /**
     * 获取分摊清册
     *
     * @param bizId 商业标识
     * @return {@link List}<{@link CostListDTO}>
     */
    List<CostListDTO> costList(Long bizId);

    // --------------------- 新增功能区 hmh start-------------------------------
    /**
     * 20230628
     * 
     * 获取业主确认证明包括投票统计
     *
     * @param bizId 业务标识
     * @return {@link OwnerCheckProveDTO}
     */
    JSONObject getOwnerCheckProveIncludeVoteCount(Long bizId);

    /**
     * 20230629
     * 
     * 获取过滤楼栋信息
     * 
     * @param buildRequest 楼栋请求类
     * @return
     */
    List<GwjBaseBuild> getBuildsFilte(GwjBaseBuildRequest buildRequest);

    /**
     * 20230629
     * 
     * 查询签署意见
     * 
     * @param gwjMaintenanceFundsBusinessLog
     * @return
     */
    List<GwjMaintenanceFundsBusinessLog> selectGwjMaintenanceFundsBusinessLogList(GwjMaintenanceFundsBusinessLog gwjMaintenanceFundsBusinessLog);

    /**
     * 20230704
     *
     * 外网业务房屋导入
     *
     * @param allocatedAmountRequest
     * @return
     */
    String importHouseList(MultipartFile fileboolean, boolean updateSupport, Long bizId) throws Exception;

    /**
     * 步骤回调
     *
     * @param jsonMsg 回调信息
     * @return
     */
    R<Boolean> resultNotify(String jsonMsg);

    /**
     * 回退步骤回调
     *
     * @param jsonMsg 回调信息
     * @return
     */
    R<Boolean> rollbackResultNotify(String jsonMsg);

    /**
     * 预受理审核
     *
     * @param jsonMsg 预受理审核参数
     * @return
     */
    R<Boolean> preAcceptExamine(String jsonMsg);

    /**
     * 查看业主征求意见 以JSON返回
     *
     * @param bizId 业务ID
     * @return
     */
    public JSONObject getOwnerCommentsJSON(Long bizId);

    /**
     * 业主证明内部调用
     * 
     * @param outServerIdentification 外网业务标识
     * @return
     */
    R<JSONObject> ownerCheckInner(String outServerIdentification, Integer bizFlagId);

    /**
     * 二次补件
     * 
     * @param bizId 业务ID
     * @return
     */
    public int preAcceptSecondSubmitByBizId(Long bizId);

    /**
     * 得到一步配置信息 获取步骤按钮权限信息
     *
     * @param businessFlagType 业务标志类型
     * @return 查询业务基础信息
     */
    public JSONObject getStepConfigInfoToJson(GwjBusinessFlagType businessFlagType);

    // ---------------------新增功能区 end-------------------------------
}
